/*


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.

// CkeNodeSpec defines the desired state of CkeNode
type CkeNodeSpec struct {
	Address string   `json:"address,omitempty"`
	Roles   []string `json:"roles,omitempty"`
	Labels  []string `json:"labels,omitempty"`
	Taints  []string `json:"taints,omitempty"`
	MaxPods int64    `json:"max_pods,omitempty"`
}

// CkeNodeStatus defines the observed state of CkeNode
type CkeNodeStatus struct {
	State                           string     `json:"state,omitempty"`
	Labels                          []string   `json:"labels,omitempty"`
	Taints                          []string   `json:"taints,omitempty"`
	CkeRole                         string     `json:"ckeRole,omitempty"`
	CkeFlags                        string     `json:"ckeFlags,omitempty"`
	Reason                          string     `json:"reason,omitempty"`
	Message                         string     `json:"message,omitempty"`
	AnsibleInit                     bool       `json:"ansibleInit,omitempty"`
	ScaleupComponents               [][]string `json:"scaleupComponents,omitempty"`
	ActiveScaleupComponent          []string   `json:"activeScaleupComponent,omitempty"`
	CompletedScaleupComponents      [][]string `json:"completedScaleupComponents,omitempty"`
	Master2SlaveComponents          []string   `json:"master2SlaveComponents,omitempty"`
	ActiveMaster2SlaveComponent     string     `json:"activeMaster2SlaveComponent,omitempty"`
	CompletedMaster2SlaveComponents []string   `json:"completedMaster2SlaveComponents,omitempty"`
	Slave2MasterComponents          []string   `json:"slave2MasterComponents,omitempty"`
	ActiveSlave2MasterComponent     string     `json:"activeSlave2MasterComponent,omitempty"`
	CompletedSlave2MasterComponents []string   `json:"completedSlave2MasterComponents,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.state"
// +kubebuilder:printcolumn:name="ROLE",type="string",JSONPath=".status.ckeRole"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="ADDRESS",type="string",JSONPath=".spec.address"
// +kubebuilder:printcolumn:name="FLAGS",type="string",JSONPath=".status.ckeFlags"

// CkeNode is the Schema for the ckenodes API
type CkeNode struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   CkeNodeSpec   `json:"spec,omitempty"`
	Status CkeNodeStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// CkeNodeList contains a list of CkeNode
type CkeNodeList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []CkeNode `json:"items"`
}

func init() {
	SchemeBuilder.Register(&CkeNode{}, &CkeNodeList{})
}
